package com.cgsrp.utils;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Result {
    private boolean flag;
    private String code;
    private Object data;
    private String msg;
    public static Result ok(Object data){
        return new Result(true,"200", data, "登录成功");
    }
    public static Result error(){
        return new Result(false,"500", null, "服务器异常");
    }
    public static Result failure(String msg){
        return new Result(false,"500",null,msg);
    }

    public static Result success(String msg){
        return new Result(true,"200",null,msg);
    }
    public static Result suc(String msg,Object data){
        return new Result(true,"200",data,msg);
    }
    public static Result fai(String msg,Object data){
        return new Result(false,"500",data,msg);
    }
}
